package br.indt.framework.ui.common;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public abstract class OptionMenuItem extends Widget {
	public Label label = null;
	public MenuActionInterface action;
	public Image divisorImage = null;
	public Image topImage = null;

	public OptionMenuItem(String option, MenuActionInterface pAction) {
		super(option);
		action = pAction;
		calculateHeight();

	}

	public void setWidth(int width) {
		this.width = width;
		label.setWidth(width - (leftMargin + rightMargin));

	}

	public void calculateHeight() {
		height = OptionMenuScreenBase.gethItem();
	}

	public int getHeight() {
		return height;
	}


	public Label getLabel() {
		return label;
	}
	
	public void setMargin(int left, int top, int right, int bottom)
	{
		leftMargin = left;
		topMargin = top;
		rightMargin = right;
		bottomMargin = bottom;
		
		//left == 0 para que a margem do label seja igual ao leftMargin do componente.
		label.setMargin(0, top, right, bottom);
	}

	public abstract void pressFire();
	
	public abstract void paint(Graphics g, int x, int y, int maxWidth, int maxHeight);
	
	public abstract void click(int x, int y);
	
	public void setHeight(int value) {
		height = value;
	}

}